<template>
  <div>
    <el-table
      :summary-method="getSummaries"
      show-summary
      :data="tableData"
      stripe
      style="width: 50% ;margin-top: 20px;font-size: 15px;"
    >

      <el-table-column prop="date" label="日期" width="180" />
      <el-table-column prop="name" label="姓名" width="180" />
      <el-table-column prop="address" label="地址" />
    </el-table>
  </div>
</template>

<script>
import Vue from 'vue'
export default {
  data() {
    return {
      batchPrice: '',
      batchStock: '',
      tableData: [
        { date: '红色', name: '16GB', address: 1000 },
        { date: '蓝色', name: '32GB', address: 1200 }
        // ... 其他数据
      ]
    }
  },
  methods: {
    getSummaries(param) {
            const { columns } = param
            const sums = []
            columns.forEach((column, index) => {
                switch (index) {
                    case 0:

                        sums[index] = '是否通过'

                        break

                    case 1:

                        sums[index] = 'erewrwr'

                        break

                    case 2:

                        sums[index] = 'erewrwr'

                        break

                    case 3:

                        sums[index] = 'erewrwr'

                        break
                }
            })

            return sums
        },
    setBatchPrice() {
    if (this.batchPrice) {
      this.tableData.forEach(row => {
        row.price = this.batchPrice // 直接设置属性
      })
      this.batchPrice = '' // 清空输入框
    }
  },
  setBatchStock() {
    if (this.batchStock) {
      this.tableData.forEach(row => {
        row.stock = this.batchStock // 直接设置属性
      })
      this.batchStock = '' // 清空输入框
    }
  },
    updateRowPrice(index, row) {
      // 你可以在这里添加逻辑来处理单行价格更新后的其他操作
    },
    updateRowStock(index, row) {
      // 你可以在这里添加逻辑来处理单行库存更新后的其他操作
    }
  }
}
</script>
